﻿namespace EFS.RC.Wallboard.Controls.Endpoints.Customer.FirstGroup
{
	/// <summary>
	/// Interaction logic for FirstGroup.xaml
	/// </summary>
	public partial class Main : System.Windows.Controls.UserControl
	{
		public Main()
		{
			InitializeComponent();
		}

		#region Properties
		/// Property HourglassImageSource: Set
		public System.Windows.Media.ImageSource HourglassImageSource
		{
			set
			{
				imageHourglass.Source = value;
			}
		}

		/// Property CW: Set
		public System.Int32 CW
		{
			set
			{
				textBlockCounterCW.Text = value.ToString();
			}
		}

		/// Property LW: Set
		public System.TimeSpan LW
		{
			set
			{
				textBlockCounterLW.Text = System.String.Format("{0}s", (System.Int32)value.TotalSeconds);
			}
		}
		#endregion

		#region Utilities
		/// UpdateSizes
		private void UpdateSizes()
		{
			textBlockCounterCW.Width = textBlockCounterLW.Width = System.Math.Max(textBlockCounterCW.ActualWidth, textBlockCounterLW.ActualWidth);
			textBlockTitleCW.Width = textBlockTitleLW.Width = System.Math.Max(textBlockTitleCW.ActualWidth, textBlockTitleLW.ActualWidth);
		}
		#endregion

		#region Events
		/// UserControl_LayoutUpdated
		private void UserControl_LayoutUpdated(object sender, System.EventArgs e)
		{
			UpdateSizes();
		}
		#endregion
	}

}